<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <base href="<%=request.getContextPath()%>/">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>医疗预约系统</title>
    <link rel="stylesheet" href="statics/css/hisStyle.css">
    <style>
        .header {
            background-color: #2c3e50;
            color: white;
            padding: 20px 0;
            margin-bottom: 30px;
        }
        .header-content {
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 20px;
        }
        .logo h1 {
            margin: 0;
            font-size: 28px;
        }
        .user-info {
            display: flex;
            align-items: center;
            gap: 20px;
        }
        .btn {
            padding: 8px 16px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            text-decoration: none;
            display: inline-block;
        }
        .btn-primary {
            background-color: #3498db;
            color: white;
        }
        .btn-primary:hover {
            background-color: #2980b9;
        }
        .btn-secondary {
            background-color: #95a5a6;
            color: white;
        }
        .btn-secondary:hover {
            background-color: #7f8c8d;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }
        .hospital-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 20px;
            margin-bottom: 40px;
        }
        .hospital-card {
            background: white;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease;
        }
        .hospital-card:hover {
            transform: translateY(-5px);
        }
        .hospital-card h3 {
            color: #2c3e50;
            margin-bottom: 10px;
        }
        .hospital-info {
            color: #7f8c8d;
            margin-bottom: 15px;
        }
        .hospital-actions {
            text-align: right;
        }
        .welcome-section {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 40px;
            border-radius: 10px;
            text-align: center;
            margin-bottom: 40px;
        }
        .welcome-section h2 {
            margin-bottom: 10px;
        }
        .features {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-top: 40px;
        }
        .feature-card {
            background: white;
            padding: 20px;
            border-radius: 10px;
            text-align: center;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }
        .feature-icon {
            font-size: 48px;
            margin-bottom: 15px;
        }
    </style>
</head>
<body>
    <div class="header">
        <div class="header-content">
            <div class="logo">
                <h1>医疗预约系统</h1>
            </div>
            <div class="user-info">
                <c:choose>
                    <c:when test="${not empty sessionScope.loginUser}">
                        <span>欢迎，${sessionScope.loginUser.username}</span>
                        <a href="frontend/my-appointments" class="btn btn-primary">我的预约</a>
                        <a href="auth/logout" class="btn btn-secondary">退出</a>
                    </c:when>
                    <c:otherwise>
                        <a href="auth/login" class="btn btn-primary">登录</a>
                        <a href="auth/register" class="btn btn-secondary" style="margin-left: 10px;">注册</a>
                    </c:otherwise>
                </c:choose>
            </div>
        </div>
    </div>

    <div class="container">
        <div class="welcome-section">
            <h2>欢迎使用医疗预约系统</h2>
            <p>便捷的在线预约，让就医更简单</p>
        </div>

        <h2>选择医院</h2>
        <div class="hospital-grid">
            <c:forEach items="${hospitals}" var="hospital">
                <div class="hospital-card">
                    <h3>${hospital.hospitalName}</h3>
                    <div class="hospital-info">
                        <p><strong>地址：</strong>${hospital.address}</p>
                        <p><strong>电话：</strong>${hospital.hphone}</p>
                    </div>
                    <div class="hospital-actions">
                        <a href="frontend/departments?hospitalId=${hospital.hospitalId}" class="btn btn-primary">
                            查看科室
                        </a>
                    </div>
                </div>
            </c:forEach>
        </div>

        <div class="features">
            <div class="feature-card">
                <div class="feature-icon">🏥</div>
                <h3>在线预约</h3>
                <p>选择医院、科室和医生，轻松完成预约</p>
            </div>
            <div class="feature-card">
                <div class="feature-icon">💳</div>
                <h3>在线支付</h3>
                <p>支持微信、支付宝等多种支付方式</p>
            </div>
            <div class="feature-card">
                <div class="feature-icon">📋</div>
                <h3>电子病单</h3>
                <p>医生在线填写病单，方便查看和管理</p>
            </div>
            <div class="feature-card">
                <div class="feature-icon">📱</div>
                <h3>移动友好</h3>
                <p>响应式设计，手机电脑都能用</p>
            </div>
        </div>
    </div>
</body>
</html>
